home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / ABox 1.9.5 / Header Files / ABUFSSpecs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-26  |  6.5 KB  |  181 lines  |  [TEXT/MMCC]

  1. /*    
  2.     Copyright © 1991-1995 by TopSoft Inc.  All rights reserved.
  3.  
  4.     You may distribute this file under the terms of the TopSoft
  5.     Artistic License, accompanying this package.
  6.     
  7.     This file was created & modified by George (ty) Tempel in 
  8.     connection with TopSoft, Inc. from Apple DTS source code:
  9.     
  10.         Apple Macintosh Developer Technical Support
  11.     
  12.         A collection of useful high-level File Manager routines.
  13.     
  14.         by Jim Luther, Apple Developer Technical Support
  15.     
  16.         from File:        MoreFilesExtras.c
  17.     
  18.         Copyright © 1992-1994 Apple Computer, Inc.
  19.         All rights reserved.
  20.     
  21.         You may incorporate this sample code into your applications without
  22.         restriction, though the sample code has been provided "AS IS" and the
  23.         responsibility for its operation is 100% yours.  However, what you are
  24.         not permitted to do is to redistribute the source as "DSC Sample Code"
  25.         after having made changes. If you're going to re-distribute the source,
  26.         we require that you make it clear in the source that the code was
  27.         descended from Apple Sample Code, but that you've made changes.
  28.  
  29.     See the Modification History for more details.
  30.  
  31. Product
  32.     About Box
  33.  
  34. FILE
  35.     ABUFSSpecs.c
  36.  
  37. NAME
  38.     ABUFSSpecs.h, part of the ABox project source code,
  39.     responsible for utility handling the AboutBox FSSpecs stuff.
  40.  
  41. DESCRIPTION
  42.     This file contains defines and prototypes for the ABUFSSpecs
  43.     utility class.
  44.     
  45. DEVELOPED BY
  46.     George (ty) Tempel                ttempel@monmouth.com
  47.     All code in this file, and its associated header file was
  48.     Created by George (ty) Tempel in connection with the TopSoft, Inc.
  49.     "FilterTop" application development, except where noted.
  50.  
  51. CARETAKER - George (ty) Tempel <ttempel@monmouth.com>
  52.      Please consult this person for any changes or suggestions to this file.
  53.  
  54. MODIFICATION HISTORY
  55.  
  56.     dd mmm yy    -    xxx    -    patchxx: description of patch
  57.     15 july 94    -    ty    -    Initial Version Created
  58.     20-july-94    -    ty    -    initial version released
  59.     23-may-95    -    ty    -    changes for compatibility with the CodeWarrior CW6
  60.                             release and the associated Universal Headers from Apple:
  61.                             most methods that returned references now have "Ref" at
  62.                             the end of their methods names to prevent possible collisions
  63.                             with datatypes and classes of the same name (older versions
  64.                             of the compiler didn't have a problem with this).
  65.     25-oct-95    -    ty    -    changes for "const" usage under CW7; simplification of Boolean
  66.                             query methods
  67.  
  68. */
  69.  
  70.  
  71. /*****************************************************************************/
  72.  
  73. class    ABUFSSpecs
  74. {
  75.     public:
  76.                             ABUFSSpecs(void);
  77.             virtual            ~ABUFSSpecs(void);
  78.             
  79.             static pascal    OSErr    GetDirID(short vRefNum,
  80.                                      long dirID,
  81.                                      StringPtr name,
  82.                                      long *theDirID,
  83.                                      Boolean *isDirectory);
  84. /*    Use GetDirID to get the directory ID number of the directory
  85.     specified.  If a file is specified, then the parent
  86.     directory of the file is returned and isDirectory is false.  If
  87.     a directory is specified, then that directory's ID number is
  88.     returned and isDirectory is true.
  89.     WARNING: Volume names on the Macintosh are *not* unique -- Multiple
  90.     mounted volumes can have the same name. For this reason, the use of a
  91.     volume name or full pathname to identify a specific volume may not
  92.     produce the results you expect.  If more than one volume has the same
  93.     name and a volume name or full pathname is used, the File Manager
  94.     currently uses the first volume it finds with a matching name in the
  95.     volume queue.
  96.     
  97.     vRefNum            input:    Volume specification.
  98.     dirID            input:    Directory ID.
  99.     name            input:    Pointer to object name, or nil when dirID
  100.                             specifies a directory that's the object.
  101.     theDirID        output:    If the object is a file, then its parent directory
  102.                             ID. If the object is a directory, then its ID.
  103.     isDirectory        output:    True if object is a directory; false if
  104.                             object is a file.
  105. */
  106.  
  107.  
  108.             static pascal    OSErr    DirIDFromFSSpec(const FSSpec *spec,
  109.                                             long *dirID,
  110.                                             Boolean *isDirectory);
  111. /*    Use DirIDFromFSSpec to get the directory ID number of the directory
  112.     specified by spec. If spec is to a file, then the parent
  113.     directory of the file is returned and isDirectory is false.  If
  114.     spec is to a directory, then that directory's ID number is
  115.     returned and isDirectory is true.
  116.     
  117.     spec            input:    An FSSpec record specifying the directory.
  118.     theDirID        output:    The directory ID.
  119.     isDirectory        output:    True if object is a directory; false if
  120.                             object is a file.
  121. */
  122.  
  123.  
  124.             static pascal    OSErr    DetermineVRefNum(StringPtr pathname,
  125.                                              short vRefNum,
  126.                                              short *realVRefNum);
  127. /*    Use DetermineVRefNum to determine the volume reference number of a
  128.     volume from a pathname, a volume specification, or a combination
  129.     of the two.
  130.     WARNING: Volume names on the Macintosh are *not* unique -- Multiple
  131.     mounted volumes can have the same name. For this reason, the use of a
  132.     volume name or full pathname to identify a specific volume may not
  133.     produce the results you expect.  If more than one volume has the same
  134.     name and a volume name or full pathname is used, the File Manager
  135.     currently uses the first volume it finds with a matching name in the
  136.     volume queue.
  137.  
  138.     pathName    input:    Pointer to a full pathname or nil.  If you pass in a 
  139.                         partial pathname, it is ignored. A full pathname to a
  140.                         volume must end with a colon character (:).
  141.     vRefNum        input:    Volume specification (volume reference number, working
  142.                         directory number, drive number, or 0).
  143.     realVRefNum    output:    The real volume reference number.
  144. */
  145.  
  146.  
  147.             static pascal    OSErr    GetDirItems(short vRefNum,
  148.                                         long dirID,
  149.                                         StringPtr name,
  150.                                         Boolean getFiles,
  151.                                         Boolean getDirectories,
  152.                                         FSSpecPtr items,
  153.                                         short reqItemCount,
  154.                                         short *actItemCount,
  155.                                         short *itemIndex);
  156. /*    Use GetDirItems to return a list of items in a directory.
  157.  
  158.     vRefNum            input:    Volume specification.
  159.     dirID            input:    Directory ID.
  160.     name            input:    Pointer to object name, or nil when dirID
  161.                             specifies a directory that's the object.
  162.     getFiles        input:    Pass true to have files added to the items list.
  163.     getDirectories    input:    Pass true to have directories added to the
  164.                             items list.
  165.     items            input:    Pointer to array of FSSpec where the item list
  166.                             is returned.
  167.     reqItemCount    input:    Maximum number of items to return (the number
  168.                             of elements in the items array).
  169.     actItemCount    output: The number of volumes actually returned.
  170.     itemIndex        input:    The current item index position. Set to 1 to
  171.                             start with the first item in the directory.
  172.                     output:    The item index position to get the next item.
  173.                             Pass this value the next time you call
  174.                             GetDirItems to start where you left off.
  175. */
  176.  
  177. };
  178.  
  179.  
  180. //    end of file.
  181.